package MyErrorCode

import "github.com/gogf/gf/v2/errors/gcode"

// 统一错误定义

var (
	errorNumberCode = map[string]int{
		"AdminService.Login.VerifyCaptcha": 10001,
	}
	errorMessage = map[string]string{
		"AdminService.Login.VerifyCaptcha": "验证码错误",
	}
)

func GetErrorCode(denote string) gcode.Code {
	return gcode.New(GetErrorNumberCode(denote), GetErrorMessage(denote), nil)
}

func GetErrorMessage(denote string) string {
	if v, ok := errorMessage[denote]; ok {
		return v
	}
	return "未知错误"
}

func GetErrorNumberCode(denote string) int {
	if v, ok := errorNumberCode[denote]; ok {
		return v
	}
	return -1
}
